#! /bin/bash

# builds systemc in $SYSCPAR_ROOT/code/<ver>
# requires:
#	previously built with 1st_build.sh
#
# tested with g++ ver. 4.4.3
#
# type --help for usage

usage="$0 --help \t\t\t - shows this\n$0 ver\t\t\t - builds systemc in \$SYSCPAR_ROOT/code/<ver> \n$0 --clean ver\t\t - cleans systemc in \$SYSCPAR_ROOT/code/<ver> "

case $1 in '-h'|'-help'|'--help')
	echo  -e $usage
	exit;;
esac

command="debug install"

if [[ $1 == "--clean" ]]; then
	command="clean"
	shift
fi

[[ -n $1 ]] || { echo -e $usage; exit 1; }
#[[ $1 == "orig" ]] && { echo "orig is reserved for original version of systemc; run 'iorig.sh' to rebuild original version"; exit 1; }

[[ -d $SYSCPAR_ROOT/code/$1/systemc-2.2.0/objdir ]] || { echo -e $usage; exit; }
cd $SYSCPAR_ROOT/code/$1/systemc-2.2.0/objdir
make $command


